package  com.customization.api.e9sso.biz;


import com.customization.commons.Console;
import com.engine.common.service.impl.FnaCommonServiceImpl;
import com.engine.workflow.biz.freeNode.FreeNodeBiz;
import com.google.common.base.Strings;
import com.greenpineyu.fel.FelEngineImpl;
import com.greenpineyu.fel.context.FelContext;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringEscapeUtils;
import weaver.conn.ConnStatement;
import weaver.conn.RecordSet;
import weaver.dateformat.DateTransformer;
import weaver.file.ExcelParse;
import weaver.file.FileUpload;
import weaver.file.ImageFileManager;
import weaver.fna.general.FnaCommon;
import weaver.fna.general.RequestDetailImportUtil;
import weaver.fna.maintenance.BudgetfeeTypeComInfo;
import weaver.fna.maintenance.FnaSystemSetComInfo;
import weaver.formmode.tree.CustomTreeData;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.browser.BrowserForDetailImportService;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.mode.FieldInfo;
import weaver.workflow.request.RequestDetailHrmImport;
import weaver.workflow.request.RequestFieldTrigger;
import weaver.workflow.request.SubjectFilter;
import weaver.workflow.workflow.WFNodeDtlFieldManager;
import weaver.workflow.workflow.WorkflowBillComInfo;

public class CusRequestDetailImport extends BaseBean {
    private int currentUserLang = 7;

    public CusRequestDetailImport() {
    }

    public boolean getAllowesImport(int var1, int var2, int var3, int var4, User var5) throws Exception {
        boolean var6 = false;
        if (var4 == 0 || var4 == 1) {
            RecordSet var7 = new RecordSet();
            var7.executeSql("SELECT nodetype FROM workflow_flownode WHERE nodetype<>3 AND nodeid=" + var3);
            if (var7.next()) {
                String var8 = Util.null2String(var7.getString("nodetype"));
                if ("0".equals(var8)) {
                    var7.executeSql("SELECT formid,isbill FROM workflow_base WHERE isImportDetail in ('1', '2') AND id=" + var2);
                } else {
                    var7.executeSql("SELECT formid,isbill FROM workflow_base WHERE isImportDetail='2' AND id=" + var2);
                }

                if (var7.next()) {
                    int var9 = var7.getInt("formid");
                    int var10 = var7.getInt("isbill");
                    if (var10 == 1 && var9 > 0) {
                        return false;
                    }

                    String var11 = "";
                    int var12 = 0;
                    int var13 = 0;
                    var7.executeSql("SELECT ismode,showdes,printdes,toexcel FROM workflow_flownode WHERE workflowid=" + var2 + " AND nodeid=" + var3);
                    if (var7.next()) {
                        var11 = Util.null2String(var7.getString("ismode"));
                        var12 = Util.getIntValue(Util.null2String(var7.getString("showdes")), 0);
                    }

                    if ("1".equals(var11) && var12 != 1) {
                        var7.executeSql("SELECT id FROM workflow_nodemode WHERE isprint='0' AND workflowid=" + var2 + " AND nodeid=" + var3);
                        if (var7.next()) {
                            var13 = var7.getInt("id");
                        } else {
                            var7.executeSql("SELECT id FROM workflow_formmode WHERE isprint='0' AND formid=" + var9 + " AND isbill='" + var10 + "'");
                            if (var7.next()) {
                                var13 = var7.getInt("id");
                            }
                        }

                        var6 = true;
                    }

                    var7.executeSql("SELECT DISTINCT groupId FROM workflow_nodeformgroup WHERE nodeid=" + var3 + " ORDER BY groupid");
                    WFNodeDtlFieldManager var14 = new WFNodeDtlFieldManager();

                    while(var7.next()) {
                        var14.resetParameter();
                        var14.setNodeid(var3);
                        var14.setGroupid(var7.getInt(1));
                        var14.selectWfNodeDtlField();
                        if ("1".equals(var14.getIsadd()) || "1".equals(var14.getIsedit()) || "1".equals(var14.getIsdelete())) {
                            if ("1".equals(var11) && var13 > 0) {
                                var7.executeSql("SELECT fieldid FROM workflow_modeview WHERE isedit='1' AND formid=" + var9 + " and isbill=" + var10 + " and nodeid=" + var3);
                            } else {
                                var7.executeSql("SELECT fieldid FROM workflow_nodeform WHERE isedit='1' AND nodeid=" + var3);
                            }

                            ArrayList var15 = new ArrayList();

                            while(var7.next()) {
                                var15.add("field" + var7.getString("fieldid"));
                            }

                            FieldInfo var16 = new FieldInfo();
                            var16.setRequestid(var1);
                            var16.setUser(var5);
                            var16.GetDetailTableField(var9, var10, 7);
                            ArrayList var17 = var16.getDetailTableFieldNames();
                            ArrayList var18 = var16.getDetailTableFields();

                            for(int var19 = 0; var19 < var17.size(); ++var19) {
                                ArrayList var20 = (ArrayList)var18.get(var19);

                                for(int var21 = 0; var21 < var20.size(); ++var21) {
                                    if (var15.indexOf((String)Util.TokenizerString((String)var20.get(var21), "_").get(0)) >= 0) {
                                        var6 = true;
                                        break;
                                    }
                                }

                                if (var6) {
                                    break;
                                }
                            }
                        }

                        if (var6) {
                            break;
                        }
                    }
                }
            }
        }

        return var6;
    }

    public boolean getImportRight(int var1, int var2, int var3, int var4) {
        boolean var5 = false;
        switch(var4) {
            case 0:
            default:
                break;
            case 1:
                RecordSet var6 = new RecordSet();
                var6.executeSql("SELECT requestid FROM workflow_currentoperator WHERE isremark='0' AND requestid=" + var1 + " AND userid=" + var3 + " AND nodeid=" + var2 + " AND EXISTS(SELECT nodeid FROM workflow_flownode WHERE nodetype=0 AND nodeid=" + var2 + ")");
                if (var6.next()) {
                    var5 = true;
                }
                break;
            case 2:
                RecordSet var7 = new RecordSet();
                var7.executeSql("SELECT requestid FROM workflow_currentoperator WHERE isremark='0' AND requestid=" + var1 + " AND userid=" + var3 + " AND nodeid=" + var2 + " AND EXISTS(SELECT nodeid FROM workflow_flownode WHERE nodetype<>3 AND nodeid=" + var2 + ")");
                if (var7.next()) {
                    var5 = true;
                }
        }

        return var5;
    }

    private String getFdName(String var1, int var2, int var3) {
        RecordSet var4 = new RecordSet();
        String var5;
        if (var2 > 0) {
            var5 = "select fieldname from workflow_billfield where id = " + var1;
        } else {
            var5 = "SELECT  a.fieldname FROM workflow_formfield wf , ( SELECT DISTINCT id , fielddbtype , fieldname ,description FROM workflow_formdictdetail ) a WHERE wf.formid = " + var3 + " AND wf.isdetail = '1' AND wf.fieldid = a.id AND a.id =  " + var1;
        }

        var4.executeSql(var5);
        return var4.next() ? var4.getString("fieldname") : null;
    }

    private String getDtName(String var1, int var2, int var3) {
        RecordSet var4 = new RecordSet();
        if (var2 > 0) {
            String var5 = "select detailtable from workflow_billfield where id = " + var1;
            var4.executeSql(var5);
            return var4.next() ? var4.getString("detailtable") : null;
        } else {
            return "workflow_formdetail";
        }
    }

    private String getDtValue(String var1, String var2, String var3) {
        RecordSet var4 = new RecordSet();
        String var5 = "select dtFieldId from mainKey where id = " + var3;
        var4.executeSql(var5);
        return var4.next() ? var4.getString("detailtable") : null;
    }

    private void colCal(String var1, int var2, int var3, Map var4, int var5, int var6) {
        String var7 = "";
        HashSet var8 = new HashSet();
        RecordSet var9 = new RecordSet();
        RecordSet var10 = new RecordSet();
        RecordSet var11 = new RecordSet();
        String var12 = "";
        String var13 = "";
        Pattern var14 = Pattern.compile("detailfield[_](\\d+)");
        Matcher var15 = null;
        var15 = var14.matcher(var1);

        while(var15.find()) {
            if ("".equals(var12)) {
                var12 = var15.group(1);
            } else {
                var8.add(var15.group(1));
            }
        }

        var13 = this.getFdName(var12, var2, var3);
        String var16 = this.getDtName(var12, var2, var3);
        ArrayList var17 = new ArrayList();
        var17.addAll(var8);
        Iterator var18 = var17.iterator();
        String var19 = "";
        HashMap var20 = new HashMap();

        String var22;
        for(int var21 = 0; var18.hasNext(); ++var21) {
            var22 = (String)var18.next();
            String var23 = this.getFdName(var22 + "", var2, var3);
            var19 = var19 + var23 + ",";
            var20.put(var23, var22);
        }

        if (var19.length() > 0) {
            var19 = var19.substring(0, var19.length() - 1);
            var22 = (String)var4.get(var16);
            if (var2 > 0) {
                var7 = "select " + var19 + ",id from " + var16 + " where " + var22 + " = " + var5;
            } else {
                var7 = "select " + var19 + ",id from " + var16 + " where requestid = " + var6;
            }

            var11.executeSql(var7);

            while(var11.next()) {
                FelEngineImpl var34 = new FelEngineImpl();
                FelContext var24 = var34.getContext();
                Iterator var25 = var20.keySet().iterator();

                while(true) {
                    String var26;
                    String var28;
                    while(var25.hasNext()) {
                        var26 = (String)var25.next();
                        int var27 = 1 + var17.indexOf(var20.get(var26));
                        var28 = var11.getString(var27);
                        if (var28 != null && !"".equals(var28)) {
                            if (var28.indexOf(",") > -1) {
                                var28 = var28.replaceAll(",", "");
                            }

                            var24.set("detailfield_" + var20.get(var26), new Double(var28));
                        } else {
                            var24.set("detailfield_" + var20.get(var26), new Double(0.0D));
                        }
                    }

                    var26 = var11.getString(var17.size() + 1);
                    Object var35 = var34.eval(var1.substring(var1.indexOf("=") + 1, var1.length()));
                    var35 = "NaN".equals(var35.toString()) ? "0" : var35;
                    if (var2 > 0) {
                        var7 = "select * from workflow_billfield where fieldname = '" + var13 + "'  and billid = " + var3;
                        if (var16 != null && !"".equals(var16)) {
                            var7 = var7 + " and detailtable = '" + var16 + "' ";
                        }

                        var9.executeSql(var7);
                        if (var9.next()) {
                            var28 = Util.null2String(var9.getString("fieldhtmltype"));
                            String var29 = Util.null2String(var9.getString("type"));
                            String var30 = Util.null2String(var9.getString("fielddbtype")).toUpperCase();
                            if (!"".equals(var35) && "1".equals(var28)) {
                                if (var35.toString().indexOf("E") > -1 || var35.toString().indexOf("e") > -1) {
                                    BigDecimal var31 = new BigDecimal(var35.toString());
                                    var35 = var31.toPlainString();
                                }

                                if (var30.indexOf("INT") >= 0) {
                                    var35 = Math.round(Double.parseDouble(var35.toString()));
                                } else {
                                    int var36;
                                    if (var30.indexOf("NUMBER") < 0 && var30.indexOf("FLOAT") < 0 && var30.indexOf("DECIMAL") < 0) {
                                        if ("5".equals(var29) && var35.toString().length() > 3) {
                                            var36 = Util.getIntValue(var9.getString("qfws"), 2);
                                            String var37 = "";

                                            for(int var38 = 0; var38 < var36; ++var38) {
                                                var37 = var37 + "#";
                                            }

                                            DecimalFormat var39 = new DecimalFormat("###,###." + var37);
                                            var35 = var39.format(Double.parseDouble(var35.toString()));
                                        }
                                    } else {
                                        var36 = var30.indexOf(",");
                                        int var32 = 2;
                                        if (var36 > -1) {
                                            var32 = Util.getIntValue(var30.substring(var36 + 1, var30.length() - 1).trim(), 2);
                                        }

                                        if ("NaN".equalsIgnoreCase(Util.null2String(var35))) {
                                            var35 = "";
                                        } else {
                                            BigDecimal var33 = new BigDecimal(var35.toString());
                                            var33 = var33.setScale(var32, 4);
                                            var35 = var33.toPlainString();
                                        }
                                    }
                                }
                            }
                        }
                    }

                    var7 = "update " + var16 + " set " + var13 + " = '" + var35 + "' where id = " + var26;
                    var10.execute(var7);
                    break;
                }
            }
        }

    }

    public void getColCalStr(int var1, int var2, String var3, Map var4, int var5, int var6, String var7) {
        RecordSet var8 = new RecordSet();
        RecordSet var9 = new RecordSet();
        String var10 = "";
        String var11 = "";
        String var12 = "";
        String var13 = "select * from workflow_formdetailinfo where formid =" + var1;
        if (var1 != 0) {
            var8.executeSql(var13);
        }

        if (var8.next()) {
            var10 = var8.getString("colcalstr");
            var11 = var8.getString("maincalstr");
            var12 = var8.getString("rowcalstr");
        }

        String[] var14;
        int var15;
        if (var12 != null && !"".equals(var12.trim())) {
            var14 = var12.split(";");

            for(var15 = 0; var15 < var14.length; ++var15) {
                this.colCal(var14[var15], var6, var1, var4, var5, var2);
            }
        }

        if (var11 != null && !"".equals(var11.trim())) {
            var14 = var11.split(";");

            for(var15 = 0; var15 < var14.length; ++var15) {
                String var16 = "";
                String var17 = "";
                String var18 = "";
                int var19 = 0;
                int var20 = 0;
                int var21 = 2;
                String[] var22 = var14[var15].split("=");
                String var23 = var22[0].replace("mainfield_", "");
                String var24 = var22[1].replace("detailfield_", "");
                if (var6 > 0) {
                    var13 = "select fieldname,fieldhtmltype,type,qfws from workflow_billfield where id = " + var23;
                } else {
                    var13 = "select fieldname,fieldhtmltype,type,qfws from workflow_formdict where id = " + var23;
                }

                var9.executeSql(var13);
                if (var9.next()) {
                    var18 = var9.getString("fieldname");
                    var19 = var9.getInt("fieldhtmltype");
                    var20 = var9.getInt("type");
                    var21 = var9.getInt("qfws");
                }

                var17 = this.getFdName(var24, var6, var1);
                var16 = this.getDtName(var24, var6, var1);
                String var25 = (String)var4.get(var16);
                if (var25 == null || "".equals(var25.trim())) {
                    var25 = "requestid";
                }

                double var26 = 0.0D;
                if (var8.getDBType().equals("oracle")) {
                    var13 = "select sum(replace(" + var17 + ",',','')) dd from " + var16 + " where " + var25 + " = " + var5;
                } else {
                    var13 = "select sum(cast(replace(" + var17 + ",',','') as decimal(18,4))) dd from " + var16 + " where " + var25 + " = " + var5;
                }

                var9.executeSql(var13);
                if (var9.next()) {
                    var26 = Util.getDoubleValue(var9.getString("dd"), 0.0D);
                }

                if (var6 > 0 && var1 < 0) {
                    if (var19 == 1 && var20 == 5) {
                        String var28 = "###,###";
                        if (var21 > 0) {
                            var28 = var28 + ".";

                            for(int var29 = 0; var29 < var21; ++var29) {
                                var28 = var28 + "#";
                            }
                        }

                        DecimalFormat var31 = new DecimalFormat(var28);
                        String var30 = var31.format(var26);
                        var13 = " update  " + var3 + " set " + var18 + " = '" + var30 + "' where id = " + var5;
                    } else {
                        var13 = " update  " + var3 + " set " + var18 + " = " + var26 + " where id = " + var5;
                    }
                } else {
                    var13 = " update  workflow_form set " + var18 + " = " + var26 + " where requestid = " + var2;
                }

                var8.executeSql(var13);
            }
        }

    }

    public String ImportDetail(FileUpload var1, User var2) throws Exception {
        RequestFieldTrigger var3 = new RequestFieldTrigger();
        FnaSystemSetComInfo var4 = new FnaSystemSetComInfo();
        int var5 = Util.getIntValue(var4.get_optionalSubject(), 0);
        int var6 = Util.getIntValue(var4.get_wfDtlImpRole4Subject(), 0);
        int var7 = Util.getIntValue(var4.get_wfDtlImpRole4Fcc(), 0);
        FnaCommonServiceImpl var8 = new FnaCommonServiceImpl();
        HashMap var9 = new HashMap();
        HashMap var10 = new HashMap();
        RequestDetailHrmImport var11 = new RequestDetailHrmImport(this.currentUserLang);
        BrowserForDetailImportService var12 = new BrowserForDetailImportService();
        boolean var13 = Util.isEnableMultiLang();
        this.currentUserLang = var2.getLanguage();
        String var14 = "\\n";
        String var15 = "";
        String var16 = "";
        String var17 = Util.null2String(var1.getParameter("ismode"));
        int var18 = Util.getIntValue(var1.getParameter("requestid"));
        int var19 = Util.getIntValue(var1.getParameter("formid"));
        int var20 = Util.getIntValue(var1.getParameter("isbill"));
        int var21 = Util.getIntValue(var1.getParameter("nodeid"));
        var21 = FreeNodeBiz.getExtendNodeId(var18, var21);
        int var22 = Util.getIntValue(var1.getParameter("modeid"));
        String var23 = Util.null2String(var1.getParameter("isFieldTrigger"));
        RecordSet var24 = new RecordSet();
        int var25 = 0;
        var24.executeSql("select workflowid from workflow_requestbase where requestid=" + var18);
        if (var24.next()) {
            var25 = var24.getInt("workflowid");
        }

        FnaCommon var26 = new FnaCommon();
        Hashtable var27 = new Hashtable();
        var27.put("hrmid", var2.getUID() + "");
        var27.put("reqid", var18 + "");
        var26.loadWFLayoutToHtmlFnaInfo(var19, var25, var18, var27);
        HashMap var28 = (HashMap)var27.get("_isEnableFnaWfHm_FnaCommon.getIsEnableFnaWfHm_workflowid=" + var25 + "__requestId=" + var18);
        if (var28 == null) {
            new HashMap();
        }

        HashMap var29 = (HashMap)var27.get("_isEnableFnaWfHm_fnaBudgetControl.getFnaWfFieldInfo4Expense_workflowid=" + var25 + "__requestId=" + var18);
        if (var29 == null) {
            var29 = new HashMap();
        }

        Object var30 = null;
        String var31 = (String)var29.get("fnaWfType");
        ArrayList var32 = new ArrayList();
        ArrayList var33 = new ArrayList();
        FieldInfo var34 = new FieldInfo();
        FieldInfo var35 = new FieldInfo();
        var34.setRequestid(var18);
        var34.setUser(var2);
        var34.GetDetailTableField(var19, var20, var2.getLanguage());
        var35.setRequestid(var18);
        var35.setUser(var2);
        var35.GetDetailTblFields(var19, var20, var2.getLanguage());
        ArrayList var36 = var34.getDetailTableFields();
        ArrayList var37 = var34.getDetailDBFieldNames();
        ArrayList var38 = var34.getDetailFieldDBTypes();
        ArrayList var39 = var34.getDetailTableNames();
        ArrayList var40 = var34.getDetailTableKeys();
        ArrayList var41 = new ArrayList();
        if (var20 == 1) {
            var41 = this.getDetailTableOrder(var39, var19);
        }

        if ("1".equals(var17) && var22 > 0) {
            var16 = "SELECT fieldid,isview,isedit FROM workflow_modeview WHERE formid=" + var19 + " AND isbill=" + var20 + " AND nodeid=" + var21;
        } else {
            var16 = "SELECT fieldid,isview,isedit FROM workflow_nodeform WHERE nodeid=" + var21;
        }

        var24.executeSql(var16);

        while(var24.next()) {
            if ("1".equals(var24.getString("isedit"))) {
                var32.add("field" + var24.getString("fieldid"));
            } else if ("1".equals(var24.getString("isview"))) {
                var33.add("field" + var24.getString("fieldid"));
            }
        }

        int var42 = 0;
        String var43 = "";
        if (var20 == 1) {
            var16 = "SELECT tablename FROM workflow_bill WHERE id=" + var19;
            var24.executeSql(var16);
            if (var24.next()) {
                var43 = Util.null2String(var24.getString("tablename"));
                var16 = "SELECT id FROM " + var43 + " WHERE requestid=" + var18;
                var24.executeSql(var16);
                if (var24.next()) {
                    var42 = var24.getInt("id");
                }
            }
        } else {
            var42 = var18;
        }

        String var44 = "";
        String var45 = "";
        int var46 = 1;
        String var47 = var1.uploadFiles("excelfile");
        ExcelParse var48 = new ExcelParse();
        var48.init(ImageFileManager.getInputStreamById(Util.getIntValue(var47)));
        HashMap var49 = new HashMap();
        WFNodeDtlFieldManager var50 = new WFNodeDtlFieldManager();
        Map var51 = this.getTableFieldValueMap(var18 + "");

        try {
            for(int var52 = 0; var52 < var36.size(); ++var52) {
                var50.resetParameter();
                var50.setNodeid(var21);
                if (var41.size() > 0) {
                    var50.setGroupid((Integer)var41.get(var52) - 1);
                } else {
                    var50.setGroupid(var52);
                }

                var50.selectWfNodeDtlField();
                String var53 = var50.getIsadd();
                String var54 = var50.getIsedit();
                String var55 = var50.getIsdelete();
                if (var20 != 1) {
                    var44 = "workflow_formdetail";
                } else {
                    var44 = Util.null2String((String)var39.get(var52));
                    var45 = Util.null2String((String)var40.get(var52));
                    if (var45.equals("")) {
                        var45 = "mainid";
                    }
                    int dtno = Util.getIntValue(var1.getParameter("dtno"),-1);
                    if(dtno>-1){
                        Console.log("传递了明细号 针对明细号进行导入 正在处理"+var44);
                        String dt=var44.substring(0,var44.lastIndexOf("_dt")+3)+dtno;
                        if(!dt.equals(var44)){
                            Console.log("传递了明细号 针对明细号进行导入 不等于要处理的明细ID，直接跳过");
                            continue;
                        }

                    }


                    var49.put(var44, var45);
                }

                ArrayList var56 = (ArrayList)var36.get(var52);
                ArrayList var57 = (ArrayList)var37.get(var52);
                ArrayList var58 = (ArrayList)var38.get(var52);
                ArrayList var59 = new ArrayList();
                ArrayList var60 = new ArrayList();
                ArrayList var61 = new ArrayList();
                ArrayList var62 = new ArrayList();
                ArrayList var63 = new ArrayList();
                ArrayList var64 = new ArrayList();

                for(int var65 = 0; var65 < var56.size(); ++var65) {
                    String[] var66 = Util.TokenizerString2((String)var56.get(var65), "_");
                    if (!"6".equals(var66[3])) {
                        if (var32.indexOf(Util.TokenizerString((String)var56.get(var65), "_").get(0)) > -1) {
                            var59.add(var56.get(var65));
                            var60.add(var57.get(var65));
                            var61.add(var58.get(var65));
                        } else if (var33.indexOf(Util.TokenizerString((String)var56.get(var65), "_").get(0)) > -1) {
                            var62.add(var56.get(var65));
                            var63.add(var57.get(var65));
                            var64.add(var58.get(var65));
                        }
                    }
                }

                ArrayList var164 = new ArrayList();
                if (var60.size() > 0) {
                    boolean var165 = true;
                    int var67 = 2;
                    HashMap var68 = new HashMap();

                    while(true) {
                        int var72;
                        if (!var165) {
                            var165 = true;
                            var67 = 2;
                            int var169 = var35.getRowSize(var52);
                            ArrayList var171 = new ArrayList();

                            while(var165) {
                                String var173 = "";
                                String var174 = "";
                                boolean var175 = false;
                                boolean var176 = true;
                                boolean var177 = false;
                                boolean var179 = true;
                                HashMap var180 = new HashMap();
                                String var78 = "";
                                boolean var79 = false;
                                int var80 = Util.getIntValue(var48.getValue("" + var46, "" + var67, "1"));
                                if (var80 > 0 && var80 <= var169) {
                                    var171.add(var80);
                                    if (!"1".equals(var54) && !"1".equals(var17)) {
                                        var79 = false;
                                    } else {
                                        var79 = true;
                                    }
                                } else if (!"1".equals(var53) && !"1".equals(var17)) {
                                    var79 = false;
                                } else {
                                    var79 = true;
                                }

                                ArrayList var81 = new ArrayList();
                                HashMap var82 = new HashMap();

                                String var84;
                                String var85;
                                String var88;
                                String var93;
                                for(int var83 = 0; var83 < var60.size(); ++var83) {
                                    var84 = "_sheetcount_" + var46 + "_rows_" + var67;
                                    var85 = "";
                                    int var86 = 0;

                                    try {
                                        var85 = Util.null2String((String)var59.get(var83)).trim();
                                    } catch (Exception var151) {
                                    }

                                    try {
                                        var86 = Util.getIntValue(var85.split("_")[0].replaceAll("field", ""));
                                    } catch (Exception var150) {
                                    }

                                    String var87 = Util.null2String((String)var60.get(var83)).trim();
                                    var88 = Util.null2String(var48.getValue("" + var46, "" + var67, "" + (var83 + 2)));
                                    boolean var89 = false;
                                    if (!"".equals(var88)) {
                                        var176 = false;
                                        if (!var79) {
                                            break;
                                        }

                                        var88 = var88.replace("'", "''");
                                        ArrayList var90 = Util.TokenizerString((String)var59.get(var83), "_");
                                        int var91 = Util.getIntValue((String)var90.get(2));
                                        int var92 = Util.getIntValue((String)var90.get(3));
                                        if (var92 == 1 && var91 == 1) {
                                            var88 = var88.replaceAll("<br>", "").replaceAll("\r", "").replaceAll("\n", "");
                                        }

                                        int var94;
                                        String var95;
                                        int var96;
                                        String var97;
                                        String var99;
                                        String var100;
                                        String var101;
                                        String var211;
                                        if (var92 == 3) {
                                            var93 = Util.null2String((String)var68.get("orgIdFieldId" + var84)).trim();
                                            var94 = Util.getIntValue((String)var68.get("orgIdFieldId_int_" + var84), 0);
                                            var95 = Util.null2String((String)var68.get("orgId2FieldId" + var84)).trim();
                                            var96 = Util.getIntValue((String)var68.get("orgId2FieldId_int_" + var84), 0);
                                            int var98;
                                            if (var93.equals(var85)) {
                                                var97 = Util.null2String((String)var68.get("orgTypeFieldValue" + var84)).trim();
                                                var98 = Util.getIntValue((String)var68.get("orgTypeFieldId" + var84));
                                                var91 = FnaCommon.getOrgSelectValueByOrgTypeSelectName(var91, var94, var98, var97, var18, var2.getLanguage(), var29, (HashMap)var30, var27);
                                            } else if (var95.equals(var85)) {
                                                var97 = Util.null2String((String)var68.get("orgType2FieldValue" + var84)).trim();
                                                var98 = Util.getIntValue((String)var68.get("orgType2FieldId" + var84));
                                                var91 = FnaCommon.getOrgSelectValueByOrgTypeSelectName(var91, var96, var98, var97, var18, var2.getLanguage(), var29, (HashMap)var30, var27);
                                            }

                                            String var102;
                                            String var103;
                                            String var104;
                                            String var106;
                                            ArrayList var209;
                                            if (!var13 && var91 == 22 && var6 != 2) {
                                                var209 = Util.TokenizerString(var88, ",");
                                                var211 = "name";
                                                if (var6 == 1) {
                                                    var211 = "codeName";
                                                }

                                                var99 = " FnaBudgetfeeType ";
                                                var100 = " count(*) as cnt ";
                                                var102 = StringEscapeUtils.escapeSql(((String)var209.get(0)).trim());
                                                var103 = " and (Archive is null or Archive = 0) and isEditFeeTypeId > 0 ";
                                                var104 = this.forMultiLangSql(var99, var100, var211, var102, var103);
                                                var24.executeSql(var104);
                                                int var105 = 0;
                                                if (var24.next()) {
                                                    var105 = var24.getInt("cnt");
                                                }

                                                var106 = ((String)var209.get(0)).trim();
                                                if (var105 < 1) {
                                                    var15 = var15 + SystemEnv.getHtmlLabelName(383991, var2.getLanguage()).replace("#rows#", String.valueOf(var67)).replace("#subjectName#", var106) + var14;
                                                    var88 = "";
                                                }

                                                if (var105 > 1) {
                                                    var15 = var15 + SystemEnv.getHtmlLabelName(383992, var2.getLanguage()).replace("#rows#", String.valueOf(var67)).replace("#subjectName#", var106) + var14;
                                                    var88 = "";
                                                }
                                            }

                                            if (var91 == 2) {
                                                if (var88.indexOf("-") < 0) {
                                                    var88 = Util.null2String(var48.getDateValue("" + var46, "" + var67, "" + (var83 + 2)));
                                                } else {
                                                    try {
                                                        var88 = TimeUtil.SetDateFormat(var88, "yyyy'-'MM'-'dd");
                                                    } catch (Exception var149) {
                                                        var88 = "";
                                                    }
                                                }
                                            } else if (var91 == 19) {
                                                if (var88.indexOf(":") < 0) {
                                                    var88 = Util.null2String(var48.getTimeValue("" + var46, "" + var67, "" + (var83 + 2)));
                                                } else if (var88.length() < 5) {
                                                    SimpleDateFormat var210 = new SimpleDateFormat("HH:mm");
                                                    Date var214 = var210.parse(var88);
                                                    var88 = var210.format(var214);
                                                }
                                            } else if (var91 == 290) {
                                                try {
                                                    var97 = Util.null2String((new BaseBean()).getPropValue("weaver_timezone_conversion", "timeZoneConversion")).trim();
                                                    DateTransformer var215 = new DateTransformer();
                                                    if (var88.indexOf(":") != -1 && var88.indexOf("-") != -1) {
                                                        if ("1".equals(var97)) {
                                                            var88 = var215.getServerDateTime(var88);
                                                        }
                                                    } else {
                                                        var88 = Util.null2String(var48.getDateTimeValue(String.valueOf(var46), String.valueOf(var67), String.valueOf(var83 + 2)));
                                                        if ("1".equals(var97)) {
                                                            var88 = var215.getServerDateTime(var88);
                                                        }
                                                    }
                                                } catch (Exception var156) {
                                                    var88 = "";
                                                }
                                            } else if (var11.isOrgField(var91)) {
                                                var88 = var11.getOrgFieldValue(var91, var88);
                                                if (Strings.isNullOrEmpty(var88)) {
                                                    var177 = true;
                                                }
                                            } else if (var91 != 161 && var91 != 162) {
                                                String var108;
                                                String var110;
                                                String var112;
                                                String var113;
                                                String var114;
                                                String var226;
                                                if (var91 != 256 && var91 != 257) {
                                                    if (var91 != 224 && var91 != 225 && var91 != 226 && var91 != 227) {
                                                        if (var91 == 296) {
                                                            this.writeLog("fna 多维度预算周期 oldvalue:" + var88 + ",workflowid" + var25 + ",requestid" + var18);
                                                            var88 = var8.getPeriodIdByName(var25, var18 + "", var2, var88);
                                                            this.writeLog("fna 多维度预算周期 value:" + var88);
                                                        } else if (var91 == 295) {
                                                            this.writeLog("fna 多维度承担主体 oldvalue:" + var88 + ",workflowid" + var25 + ",requestid" + var18);
                                                            var88 = var8.getBearerIdByName(var25, var18 + "", var2, var88);
                                                            this.writeLog("fna 多维度承担主体 value:" + var88);
                                                        } else if (var91 == 294) {
                                                            this.writeLog("fna 多维度预算科目 oldvalue:" + var88 + ",workflowid" + var25 + ",requestid" + var18);
                                                            var88 = var8.getSubjectIdByName(var25, var18 + "", var2, var88);
                                                            this.writeLog("fna 多维度预算科目 value:" + var88);
                                                        } else {
                                                            if (var91 == 22 && var6 == 2) {
                                                                var209 = Util.TokenizerString(var88, ",");
                                                                RequestDetailImportUtil var220 = new RequestDetailImportUtil();
                                                                StringBuffer var216 = new StringBuffer();
                                                                int var224 = var220.checkSubjectRepeat(var13, var2, ((String)var209.get(0)).trim(), var216, var46, var67, var14);
                                                                if ("".equals(var216.toString())) {
                                                                    var88 = String.valueOf(var224);
                                                                } else {
                                                                    var15 = var15 + var216.toString();
                                                                    var88 = "";
                                                                }
                                                            } else {
                                                                var24.executeSql("SELECT tablename,columname,keycolumname FROM workflow_browserurl WHERE id=" + var91);
                                                                if (!var24.next()) {
                                                                    var88 = "";
                                                                } else {
                                                                    var209 = Util.TokenizerString(var88, ",");
                                                                    var88 = "";
                                                                    var211 = Util.null2String(var24.getString("keycolumname"));
                                                                    var99 = Util.null2String(var24.getString("tablename"));
                                                                    var100 = Util.null2String(var24.getString("columname"));
                                                                    if (!"".equals(var211) && !"".equals(var99) && !"".equals(var100)) {
                                                                        var101 = null;
                                                                        var102 = null;
                                                                        var103 = null;
                                                                        var104 = null;
                                                                        var226 = null;

                                                                        for(int var227 = 0; var227 < var209.size(); ++var227) {
                                                                            String var232;
                                                                            if ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase()) && var7 == 2) {
                                                                                RequestDetailImportUtil var233 = new RequestDetailImportUtil();
                                                                                StringBuffer var235 = new StringBuffer();
                                                                                var232 = Util.null2String((String)var209.get(var227));
                                                                                var110 = var233.checkCostCenterImport(var13, var2, var232, var235, var14);
                                                                                if ("".equals(var235.toString())) {
                                                                                    if (var88.equals("")) {
                                                                                        var88 = var110;
                                                                                    } else {
                                                                                        var88 = var88 + "," + var110;
                                                                                    }
                                                                                } else {
                                                                                    var15 = var15 + var235.toString();
                                                                                    var88 = "";
                                                                                }
                                                                            } else {
                                                                                String var111;
                                                                                if (var13 && ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase()) || var91 == 22)) {
                                                                                    HashMap var229 = null;
                                                                                    Object var230 = null;
                                                                                    if ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase())) {
                                                                                        if (var9.containsKey("FnaCostCenter")) {
                                                                                            var229 = (HashMap)var9.get("FnaCostCenter");
                                                                                            var230 = (List)var10.get("FnaCostCenter");
                                                                                        } else {
                                                                                            var229 = new HashMap();
                                                                                            var9.put("FnaCostCenter", var229);
                                                                                            var230 = new ArrayList();
                                                                                            var10.put("FnaCostCenter", var230);
                                                                                            RecordSet var231 = new RecordSet();
                                                                                            var231.executeQuery("select a.id, a.name, a.code from FnaCostCenter a where (a.Archive is null or a.Archive=0) and a.type=1 order by a.id DESC", new Object[0]);

                                                                                            while(var231.next()) {
                                                                                                var110 = var231.getString("id");
                                                                                                var111 = null;
                                                                                                if (var7 == 1) {
                                                                                                    var111 = Util.null2String(var231.getString("code")).trim();
                                                                                                } else {
                                                                                                    var111 = Util.null2String(var231.getString("name")).trim();
                                                                                                }

                                                                                                if (var111.indexOf("`~`") >= 0) {
                                                                                                    var112 = Util.formatMultiLang(var111, String.valueOf(var2.getLanguage()));
                                                                                                    if (!"".equals(var112)) {
                                                                                                        if (var229.containsKey(var112)) {
                                                                                                            ((List)var230).add(var112);
                                                                                                        } else {
                                                                                                            var229.put(var112, var110);
                                                                                                        }
                                                                                                    }
                                                                                                } else if (!"".equals(var111)) {
                                                                                                    if (var229.containsKey(var111)) {
                                                                                                        ((List)var230).add(var111);
                                                                                                    } else {
                                                                                                        var229.put(var111, var110);
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    } else if (var91 == 22) {
                                                                                        if (var9.containsKey("22")) {
                                                                                            var229 = (HashMap)var9.get("22");
                                                                                            var230 = (List)var10.get("22");
                                                                                        } else {
                                                                                            var232 = "";
                                                                                            if ("change".equals(var31) || var20 == 1 && var19 == 159) {
                                                                                                var232 = var232 + " a.isEditFeeType = 1 and ";
                                                                                            } else if (var5 == 1) {
                                                                                                var232 = var232 + " not EXISTS (select 1 from FnaBudgetfeeType a1 where a1.supsubject = a.id) and ";
                                                                                            }

                                                                                            var229 = new HashMap();
                                                                                            var9.put("22", var229);
                                                                                            var230 = new ArrayList();
                                                                                            var10.put("22", var230);
                                                                                            RecordSet var237 = new RecordSet();
                                                                                            var237.executeQuery("select a.id, a.name, a.codeName from FnaBudgetfeeType a where " + var232 + " (a.Archive is null or a.Archive=0) and a.ISEDITFEETYPEID > 0 order by a.id DESC", new Object[0]);

                                                                                            while(var237.next()) {
                                                                                                var111 = var237.getString("id");
                                                                                                var112 = null;
                                                                                                if (var6 == 1) {
                                                                                                    var112 = Util.null2String(var237.getString("codeName")).trim();
                                                                                                } else {
                                                                                                    var112 = Util.null2String(var237.getString("name")).trim();
                                                                                                }

                                                                                                if (var112.indexOf("`~`") >= 0) {
                                                                                                    var113 = Util.formatMultiLang(var112, String.valueOf(var2.getLanguage()));
                                                                                                    if (!"".equals(var113)) {
                                                                                                        if (var229.containsKey(var113)) {
                                                                                                            ((List)var230).add(var113);
                                                                                                        } else {
                                                                                                            var229.put(var113, var111);
                                                                                                        }
                                                                                                    }
                                                                                                } else if (!"".equals(var112)) {
                                                                                                    if (var229.containsKey(var112)) {
                                                                                                        ((List)var230).add(var112);
                                                                                                    } else {
                                                                                                        var229.put(var112, var111);
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }

                                                                                    var232 = Util.null2String((String)var209.get(var227));
                                                                                    boolean var239 = true;
                                                                                    if (((List)var230).contains(var232)) {
                                                                                        if ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase())) {
                                                                                            var239 = false;
                                                                                            var15 = var15 + " " + SystemEnv.getHtmlLabelName(383993, var2.getLanguage()).replace("#impKey#", var232) + var14;
                                                                                            var88 = "";
                                                                                        } else if (var91 == 22) {
                                                                                            var239 = false;
                                                                                            var15 = var15 + " " + SystemEnv.getHtmlLabelName(383995, var2.getLanguage()).replace("#impKey#", var232) + var14;
                                                                                            var88 = "";
                                                                                        }
                                                                                    } else if (var229.containsKey(var232)) {
                                                                                        var111 = (String)var229.get(var232);
                                                                                        if (var88.equals("")) {
                                                                                            var88 = var111;
                                                                                        } else {
                                                                                            var88 = var88 + "," + var111;
                                                                                        }
                                                                                    } else if ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase())) {
                                                                                        var239 = false;
                                                                                        var15 = var15 + " " + SystemEnv.getHtmlLabelName(383996, var2.getLanguage()).replace("#impKey#", var232) + var14;
                                                                                        var88 = "";
                                                                                    } else if (var91 == 22) {
                                                                                        var239 = false;
                                                                                        var15 = var15 + " " + SystemEnv.getHtmlLabelName(383997, var2.getLanguage()).replace("#impKey#", var232) + var14;
                                                                                        var88 = "";
                                                                                    }
                                                                                } else {
                                                                                    var110 = ((String)var209.get(var227)).trim();
                                                                                    var111 = " and (canceled=0 or canceled is null)  ORDER BY " + var211 + " DESC";
                                                                                    var101 = this.forMultiLangSql(var99, var211, var100, var110, var111);
                                                                                    var111 = " and canceled=1 ORDER BY " + var211 + " DESC";
                                                                                    var102 = this.forMultiLangSql(var99, var211, var100, var110, var111);
                                                                                    if ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase())) {
                                                                                        if (var7 == 1) {
                                                                                            var100 = "code";
                                                                                        }

                                                                                        var110 = StringEscapeUtils.escapeSql(((String)var209.get(var227)).trim());
                                                                                        var111 = " and (Archive is null or Archive=0) and type=1  ORDER BY " + var211 + " DESC";
                                                                                        var103 = this.forMultiLangSql(var99, var211, var100, var110, var111);
                                                                                        var108 = "count(*) cnt";
                                                                                        var110 = StringEscapeUtils.escapeSql(((String)var209.get(var227)).trim());
                                                                                        var111 = " and (Archive is null or Archive=0) and type=1 ";
                                                                                        var104 = this.forMultiLangSql(var99, var108, var100, var110, var111);
                                                                                    } else if (var91 == 22) {
                                                                                        if (var6 == 1) {
                                                                                            var100 = "codeName";
                                                                                        }

                                                                                        var112 = "";
                                                                                        if ("change".equals(var31) || var20 == 1 && var19 == 159) {
                                                                                            var112 = var112 + " FnaBudgetfeeType.isEditFeeType = 1 and ";
                                                                                        } else if (var5 == 1) {
                                                                                            var112 = var112 + " not EXISTS (select 1 from FnaBudgetfeeType a1 where a1.supsubject = FnaBudgetfeeType.id) and ";
                                                                                        }

                                                                                        var110 = StringEscapeUtils.escapeSql(((String)var209.get(var227)).trim());
                                                                                        var111 = " and " + var112 + " (Archive is null or Archive=0) and ISEDITFEETYPEID > 0  ORDER BY " + var211 + " DESC";
                                                                                        var226 = this.forMultiLangSql(var99, var211, var100, var110, var111);
                                                                                    }

                                                                                    var110 = StringEscapeUtils.escapeSql(((String)var209.get(var227)).trim());
                                                                                    var111 = " ORDER BY " + var211 + " DESC";
                                                                                    if (var91 != 23 && var91 != 179) {
                                                                                        var16 = var11.querySqlByNameAndId(var99, var211, var100, var110, var111);
                                                                                    } else {
                                                                                        if (Util.isEnableMultiLang()) {
                                                                                            var112 = "";
                                                                                            if (this.currentUserLang > 9) {
                                                                                                var112 = this.currentUserLang + "";
                                                                                            } else {
                                                                                                var112 = this.currentUserLang + " ";
                                                                                            }

                                                                                            if (var91 == 23) {
                                                                                                var16 = "SELECT " + var211 + " FROM " + var99 + " WHERE isdata =2 and (mark ='" + var110 + "'  or mark like '%`~`" + var112 + var110 + "`~`%')";
                                                                                            } else {
                                                                                                var16 = "SELECT " + var211 + " FROM " + var99 + " WHERE isdata =1 and (mark ='" + var110 + "'  or mark like '%`~`" + var112 + var110 + "`~`%')";
                                                                                            }
                                                                                        } else if (var91 == 23) {
                                                                                            var16 = "SELECT " + var211 + " FROM " + var99 + " WHERE isdata=2 and mark='" + var110 + "' ";
                                                                                        } else {
                                                                                            var16 = "SELECT " + var211 + " FROM " + var99 + " WHERE isdata=1 and mark='" + var110 + "' ";
                                                                                        }

                                                                                        if (var111 != null && !var111.equals("")) {
                                                                                            var16 = var16 + var111;
                                                                                        }
                                                                                    }

                                                                                    boolean var241 = true;
                                                                                    if (!"hrmdepartmentallview".equals(var99.toLowerCase()) && !"hrmsubcompanyallview".equals(var99.toLowerCase())) {
                                                                                        if ("FnaCostCenter".equalsIgnoreCase(var99.toLowerCase())) {
                                                                                            int var240 = 0;
                                                                                            var24.executeQuery(var104, new Object[0]);
                                                                                            if (var24.next()) {
                                                                                                var240 = var24.getInt("cnt");
                                                                                            }

                                                                                            var114 = ((String)var209.get(var227)).trim();
                                                                                            if (var240 < 1) {
                                                                                                var241 = false;
                                                                                                var15 = var15 + " " + SystemEnv.getHtmlLabelName(383996, var2.getLanguage()).replace("#impKey#", var114) + var14;
                                                                                                var88 = "";
                                                                                            } else if (var240 > 1) {
                                                                                                var241 = false;
                                                                                                var15 = var15 + " " + SystemEnv.getHtmlLabelName(383993, var2.getLanguage()).replace("#impKey#", var114) + var14;
                                                                                                var88 = "";
                                                                                            }

                                                                                            var24.executeSql(var103);
                                                                                        } else if (var91 == 22) {
                                                                                            var24.executeSql(var226);
                                                                                        } else {
                                                                                            Console.log("var16:"+var16);
                                                                                            var24.executeQuery(var16, new Object[0]);
                                                                                        }
                                                                                    } else {
                                                                                        var24.executeSql(var101);
                                                                                        if (var24.getCounts() >= 1) {
                                                                                            var24.executeSql(var101);
                                                                                        } else {
                                                                                            var24.executeSql(var102);
                                                                                        }
                                                                                    }

                                                                                    if (var241 && var24.next()) {
                                                                                        if (var88.equals("")) {
                                                                                            var88 = var24.getString(1);
                                                                                        } else {
                                                                                            var88 = var88 + "," + var24.getString(1);
                                                                                        }
                                                                                    } else {
                                                                                        this.writeLog("[LOG]Detail Import query result empty! SQL:" + var16);
                                                                                        var177 = true;
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }

                                                            if (var91 == 22) {
                                                                BudgetfeeTypeComInfo var217 = new BudgetfeeTypeComInfo();
                                                                ArrayList var221 = new ArrayList();
                                                                var217.getWfBrowdefListByFeelevel(var25 + "", var86 + "", "22", var221);
                                                                boolean var219 = true;
                                                                if (var221.size() == 0) {
                                                                    var219 = false;
                                                                }

                                                                ArrayList var225 = new ArrayList();
                                                                if (var219) {
                                                                    var217.getWfBrowdefListByFeelevel_canSelect(var25 + "", var86 + "", "22", var225);
                                                                }

                                                                if (var219 && !var225.contains(var88)) {
                                                                    var88 = "";
                                                                }
                                                            }

                                                            if (var91 == 17 && var24.getDBType().equals("oracle")) {
                                                                var180.put(var60.get(var83), var88);
                                                                var88 = " ";
                                                            }
                                                        }
                                                    }
                                                } else {
                                                    CustomTreeData var213 = new CustomTreeData();
                                                    RecordSet var218 = new RecordSet();
                                                    var99 = (String)var61.get(var83);
                                                    var100 = "select id,tablename,tablekey,showfield,datacondition from mode_customtreedetail where mainid = " + var99;
                                                    var24.executeSql(var100);
                                                    var101 = "";
                                                    var102 = "";
                                                    var103 = "";
                                                    var104 = "";
                                                    var226 = "";
                                                    var106 = "";

                                                    while(true) {
                                                        while(var24.next()) {
                                                            var101 = var24.getString("id");
                                                            var104 = var24.getString("tablename");
                                                            var226 = var24.getString("tablekey");
                                                            var106 = var24.getString("showfield");
                                                            if (var88.indexOf(",") > -1) {
                                                                String[] var228 = var88.split(",");
                                                                var108 = "";

                                                                for(int var109 = 0; var109 < var228.length; ++var109) {
                                                                    var112 = var106.toLowerCase();
                                                                    var113 = var228[var109];
                                                                    var114 = this.forMultiLangSql(var104, var226, var112, var113);
                                                                    String var116 = var213.getVdatasourceByNodeId(var101);
                                                                    if (var116.equals("")) {
                                                                        var218.executeSql(var114);
                                                                    } else {
                                                                        var218.executeSql(var114, var116);
                                                                    }

                                                                    if (var218.next()) {
                                                                        var103 = var218.getString(var226);
                                                                        if ("".equals(var108)) {
                                                                            var108 = var101 + "_" + var103;
                                                                        } else {
                                                                            var108 = var108 + "," + var101 + "_" + var103;
                                                                        }
                                                                    }
                                                                }

                                                                if (!"".equals(var108)) {
                                                                    if ("".equals(var102)) {
                                                                        var102 = var108;
                                                                    } else {
                                                                        var102 = var102 + "," + var108;
                                                                    }
                                                                }
                                                            } else {
                                                                String var107 = "";
                                                                var110 = var106.toLowerCase();
                                                                var112 = this.forMultiLangSql(var104, var226, var110, var88);
                                                                var114 = var213.getVdatasourceByNodeId(var101);
                                                                if (var114.equals("")) {
                                                                    var218.executeSql(var112);
                                                                } else {
                                                                    var218.executeSql(var112, var114);
                                                                }

                                                                if (var218.next()) {
                                                                    var103 = var218.getString(var226);
                                                                    var107 = var101 + "_" + var103;
                                                                }

                                                                if (!"".equals(var107)) {
                                                                    if ("".equals(var102)) {
                                                                        var102 = var107;
                                                                    } else {
                                                                        var102 = var102 + "," + var107;
                                                                    }
                                                                }
                                                            }
                                                        }

                                                        var88 = var102;
                                                        break;
                                                    }
                                                }
                                            } else {
                                                HashMap var212 = new HashMap();
                                                var212.put("fieldname", var87);
                                                var212.put("fieldvalue", var88);
                                                var212.put("browsertype", var91 + "");
                                                var212.put("dbtype", (String)var61.get(var83));
                                                var81.add(var212);
                                                var89 = true;
                                            }
                                        } else if (var92 == 4) {
                                            if (!"1".equals(var88) && !var88.toLowerCase().equals(SystemEnv.getHtmlLabelName(25104, var2.getLanguage()).toLowerCase())) {
                                                var88 = "";
                                            } else {
                                                var88 = "1";
                                            }
                                        } else if (var92 == 5) {
                                            if (var91 == 2) {
                                                var93 = var88;
                                                boolean var204 = false;
                                                ArrayList var206 = Util.TokenizerString(var88, ",");
                                                var88 = "";

                                                for(var96 = 0; var96 < var206.size(); ++var96) {
                                                    if (((String)var206.get(var96)).length() > 0) {
                                                        var97 = "workflow_selectitem";
                                                        var211 = "selectvalue";
                                                        var99 = "selectname";
                                                        var100 = (String)var206.get(var96);
                                                        var101 = " and fieldid=" + ((String)var90.get(0)).substring(5);
                                                        var16 = this.forMultiLangSql(var97, var211, var99, var100, var101);
                                                        Console.log("var16 sql:"+var16);
                                                        var24.executeSql(var16);
                                                        if (var24.next()) {
                                                            if (var17.equals("1")) {
                                                                var88 = var24.getString(1);
                                                                break;
                                                            }

                                                            if (var88.equals("")) {
                                                                var88 = var24.getString(1);
                                                            } else {
                                                                var88 = var88 + "," + var24.getString(1);
                                                            }
                                                        } else {
                                                            var164.add(var46 + "," + var67 + "," + (var83 + 1));
                                                            var204 = true;
                                                        }
                                                    }
                                                }

                                                if (var88.equals("") && !var93.trim().equals("") && !var204) {
                                                    var164.add(var46 + "," + var67 + "," + (var83 + 1));
                                                }
                                            } else {
                                                var93 = "workflow_selectitem";
                                                String var205 = "selectvalue";
                                                var95 = "selectname";
                                                var97 = " and fieldid=" + ((String)var90.get(0)).substring(5);
                                                var16 = this.forMultiLangSql(var93, var205, var95, var88, var97);
                                                Console.log("var16:"+var16);
                                                var24.executeSql(var16);
                                                if (var24.next()) {
                                                    var88 = var24.getString(1);
                                                } else {
                                                    var88 = "";
                                                    var164.add(var46 + "," + var67 + "," + (var83 + 1));
                                                }
                                            }
                                        }

                                        RecordSet var203 = new RecordSet();
                                        if (var92 == 1 && var91 == 5) {
                                            var94 = 2;
                                            if (var20 == 0) {
                                                var203.executeSql("select fielddbtype,qfws  from workflow_formdictdetail where id=" + ((String)var90.get(0)).substring(5));
                                            } else {
                                                var203.executeSql("select fielddbtype,qfws from workflow_billfield where id=" + ((String)var90.get(0)).substring(5));
                                            }

                                            if (var203.next()) {
                                                var94 = Util.getIntValue(var203.getString("qfws"), 2);
                                            }

                                            if (!var88.equals("")) {
                                                var88 = var88.replace(",", "");
                                                BigDecimal var207 = new BigDecimal(var88);
                                                double var208 = var207.setScale(var94, 4).doubleValue();
                                                var211 = "0.";

                                                for(int var222 = 0; var222 < var94; ++var222) {
                                                    var211 = var211 + "0";
                                                }

                                                DecimalFormat var223 = new DecimalFormat(var211);
                                                var88 = var223.format(var208);
                                                var88 = Util.milfloatFormat(var88);
                                            }
                                        }

                                        if (!"".equals(var88)) {
                                            var82.put("$" + (var20 == 1 ? var44 : "detail") + "_" + var87 + "$", var88);
                                            if (var80 > 0 && var80 <= var169) {
                                                if ("".equals(var173)) {
                                                    var173 = "UPDATE " + var44 + " SET ";
                                                    var174 = " WHERE " + this.getPKCondition(var34, var43, var44, var19, var20, var52, var80 - 1);
                                                    if (var20 == 1) {
                                                        var174 = var174 + " AND " + var45 + "=" + var42;
                                                        var78 = " WHERE " + this.getPKCondition(var34, var43, var44, var19, var20, var52, var80 - 1) + " AND " + var45 + "=" + var42;
                                                    } else {
                                                        var174 = var174 + " AND requestid=" + var18 + " AND groupid=" + var52;
                                                        var78 = " WHERE " + this.getPKCondition(var34, var43, var44, var19, var20, var52, var80 - 1) + " AND requestid=" + var18 + " AND groupid=" + var52;
                                                    }

                                                    if (!var89) {
                                                        var173 = var173 + var60.get(var83) + "=";
                                                        if (!((String)var61.get(var83)).toLowerCase().contains("int") && !((String)var61.get(var83)).toLowerCase().contains("number") && !((String)var61.get(var83)).toLowerCase().contains("decimal") && !((String)var61.get(var83)).toLowerCase().contains("browser.")) {
                                                            var173 = var173 + "'" + var88 + "'";
                                                        } else {
                                                            var173 = var173 + "'" + var88 + "'";
                                                        }

                                                        var179 = false;
                                                    }
                                                } else if (!var89) {
                                                    if (var179) {
                                                        var173 = var173 + var60.get(var83) + "=";
                                                        var179 = false;
                                                    } else {
                                                        var173 = var173 + "," + var60.get(var83) + "=";
                                                    }

                                                    if (!((String)var61.get(var83)).toLowerCase().contains("int") && !((String)var61.get(var83)).toLowerCase().contains("number") && !((String)var61.get(var83)).toLowerCase().contains("decimal") && !((String)var61.get(var83)).toLowerCase().contains("browser.")) {
                                                        var173 = var173 + "'" + var88 + "'";
                                                    } else {
                                                        var173 = var173 + "'" + var88 + "'";
                                                    }
                                                }
                                            } else {
                                                var179 = false;
                                                if ("".equals(var173)) {
                                                    int dtno = Util.getIntValue(var1.getParameter("dtno"),-1);
                                                    if(dtno>-1){
                                                        Console.log("传递了明细号 针对明细号进行导入 正在处理"+var44);
                                                        String dt =var44.substring(0,var44.lastIndexOf("_dt")+3)+dtno;
                                                        var173 = "INSERT INTO " + dt + "(";
                                                    }else{
                                                        Console.log("传递了明细号 原导入逻辑");
                                                        var173 = "INSERT INTO " + var44 + "(";
                                                    }


                                                    var174 = " VALUES(";
                                                    if (var20 == 1) {
                                                        var173 = var173 + var45;
                                                        var174 = var174 + var42;
                                                    } else {
                                                        var173 = var173 + "requestid,groupid";
                                                        var174 = var174 + var18 + "," + var52;
                                                    }

                                                    if (!var89) {
                                                        var173 = var173 + "," + var60.get(var83);
                                                        if (!((String)var61.get(var83)).toLowerCase().contains("int") && !((String)var61.get(var83)).toLowerCase().contains("number") && !((String)var61.get(var83)).toLowerCase().contains("decimal") && !((String)var61.get(var83)).toLowerCase().contains("browser.")) {
                                                            var174 = var174 + ",'" + var88 + "'";
                                                        } else {
                                                            var174 = var174 + ",'" + var88 + "'";
                                                        }
                                                    }
                                                } else if (!var89) {
                                                    var173 = var173 + "," + var60.get(var83);
                                                    if (!((String)var61.get(var83)).toLowerCase().contains("int") && !((String)var61.get(var83)).toLowerCase().contains("number") && !((String)var61.get(var83)).toLowerCase().contains("decimal") && !((String)var61.get(var83)).toLowerCase().contains("browser.")) {
                                                        var174 = var174 + ",'" + var88 + "'";
                                                    } else {
                                                        var174 = var174 + ",'" + var88 + "'";
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if (var79) {
                                    if (!"".equals(var173)) {
                                        Map var183 = var12.getBrowerData(var51, var82, var2, var44, var81);
                                        if (var183 != null && var81 != null && var81.size() != var183.size()) {
                                            this.writeLog(" RequestDetailImport  自定义浏览框数据 start------------------------requestid:" + var18);
                                            this.writeLog("customBrowserFieldInfo:" + var81.toString());
                                            this.writeLog("curBrowserValues:" + var183.toString());
                                            this.writeLog(" RequestDetailImport  自定义浏览框数据 end------------------------");
                                        }

                                        Iterator var184;
                                        Entry var186;
                                        String var188;
                                        int var189;
                                        String var194;
                                        if (var80 > 0 && var80 <= var169) {
                                            var184 = var183.entrySet().iterator();

                                            while(var184.hasNext()) {
                                                var186 = (Entry)var184.next();
                                                if (var179) {
                                                    var173 = var173 + (String)var186.getKey() + " = '" + var186.getValue() + "' ";
                                                    var179 = false;
                                                } else {
                                                    var173 = var173 + "," + (String)var186.getKey() + " = '" + var186.getValue() + "' ";
                                                }
                                            }
                                        } else {
                                            for(var184 = var183.entrySet().iterator(); var184.hasNext(); var174 = var174 + ",'" + var186.getValue() + "'") {
                                                var186 = (Entry)var184.next();
                                                var173 = var173 + "," + (String)var186.getKey();
                                            }

                                            int var185 = 0;

                                            while(true) {
                                                if (var185 >= var62.size()) {
                                                    var173 = var173 + ")";
                                                    var174 = var174 + ")";
                                                    break;
                                                }

                                                ArrayList var187 = Util.TokenizerString((String)var62.get(var185), "_");
                                                var188 = "";
                                                var189 = Util.getIntValue((String)var187.get(2));
                                                int var234 = Util.getIntValue((String)var187.get(3));
                                                if (var234 == 3) {
                                                    if (var189 != 1 && var189 != 165 && var189 != 17 && var189 != 166) {
                                                        if (var189 == 2) {
                                                            var188 = TimeUtil.getCurrentDateString();
                                                        } else if (var189 == 19) {
                                                            var194 = "HH:mm";
                                                            SimpleDateFormat var192 = new SimpleDateFormat(var194);
                                                            Calendar var200 = Calendar.getInstance();
                                                            var188 = var192.format(var200.getTime());
                                                        } else if (var189 != 4 && var189 != 167 && var189 != 57 && var189 != 168) {
                                                            if (var189 == 42 || var189 == 164 || var189 == 169 || var189 == 170) {
                                                                var188 = "" + var2.getUserSubCompany1();
                                                            }
                                                        } else {
                                                            var188 = "" + var2.getUserDepartment();
                                                        }
                                                    } else {
                                                        var188 = "" + var2.getUID();
                                                    }
                                                }

                                                var16 = "SELECT customervalue FROM workflow_addinoperate WHERE ispreadd='1' AND isnode=1 AND objid=" + var21 + " AND fieldid=" + ((String)var187.get(0)).substring(5);
                                                var24.executeSql(var16);
                                                if (var24.next()) {
                                                    var188 = Util.null2String(var24.getString("customervalue"));
                                                }

                                                if (!var188.equals("")) {
                                                    var173 = var173 + "," + var63.get(var185);
                                                    if (!((String)var64.get(var185)).toLowerCase().contains("int") && !((String)var64.get(var185)).toLowerCase().contains("number") && !((String)var64.get(var185)).toLowerCase().contains("decimal")) {
                                                        var174 = var174 + ",'" + var188 + "'";
                                                    } else {
                                                        var174 = var174 + ",'" + var188 + "'";
                                                    }
                                                }

                                                ++var185;
                                            }
                                        }

                                        try {
                                            if (!var179) {
                                                Console.log("sql:"+var173 + var174);
                                                var175 = var24.executeSql(var173 + var174);

                                            }

                                            if (var24.getDBType().equals("oracle")) {
                                                try {
                                                    String var201;
                                                    if (var80 > 0 && var80 <= var169) {
                                                        var84 = "";
                                                        int dtno = Util.getIntValue(var1.getParameter("dtno"),-1);
                                                        if(dtno>-1){
                                                            Console.log("传递了明细号 针对明细号进行导入 正在处理"+var44);
                                                            String dt=var44.substring(0,var44.lastIndexOf("_dt")+3)+dtno;
                                                            var84 = " update " + dt + " set";
                                                        }else{
                                                            Console.log("传递了明细号 原导入逻辑");
                                                            var84 = " update " + var44 + " set";
                                                        }

                                                        int var190 = 0;
                                                        var188 = " ";

                                                        Iterator var191;
                                                        String var197;
                                                        for(var191 = var180.entrySet().iterator(); var191.hasNext(); var188 = ",") {
                                                            ++var190;
                                                            Entry var236 = (Entry)var191.next();
                                                            var194 = var236.getKey().toString();
                                                            var197 = "";
                                                            if (var236.getValue() != null) {
                                                                if (String.valueOf(var236.getValue()).equals(" ")) {
                                                                    var197 = "";
                                                                } else {
                                                                    var197 = String.valueOf(var236.getValue());
                                                                }
                                                            }

                                                            var84 = var84 + var188 + " " + var194 + "=? ";
                                                        }

                                                        var84 = var84 + var78;
                                                        if (var190 > 0) {
                                                            ConnStatement var238 = null;

                                                            try {
                                                                var238 = new ConnStatement();
                                                                var238.setStatementSql(var84);
                                                                var191 = var180.entrySet().iterator();

                                                                for(var190 = 0; var191.hasNext(); var238.setString(var190, var201)) {
                                                                    ++var190;
                                                                    Entry var199 = (Entry)var191.next();
                                                                    var197 = var199.getKey().toString();
                                                                    var201 = "";
                                                                    if (var199.getValue() != null) {
                                                                        if (String.valueOf(var199.getValue()).equals(" ")) {
                                                                            var201 = "";
                                                                        } else {
                                                                            var201 = String.valueOf(var199.getValue());
                                                                        }
                                                                    }
                                                                }

                                                                var238.executeUpdate();
                                                            } catch (Exception var159) {
                                                                this.writeLog(var159);
                                                            } finally {
                                                                if (var238 != null) {
                                                                    var238.close();
                                                                }

                                                            }
                                                        }
                                                    } else {

                                                        int dtno = Util.getIntValue(var1.getParameter("dtno"),-1);
                                                        if(dtno>-1){
                                                            Console.log("传递了明细号 针对明细号进行导入 正在处理"+var44);
                                                            String dt=var44.substring(0,var44.lastIndexOf("_dt")+3)+dtno;
                                                            var84 = "select max(id) dtid from " + dt + " where ";
                                                        }else{
                                                            Console.log("传递了明细号 原导入逻辑");
                                                            var84 = "select max(id) dtid from " + var44 + " where ";
                                                        }



                                                        if (var20 == 1) {
                                                            var84 = var84 + var45 + "=" + var42;
                                                        } else {
                                                            var84 = var84 + " requestid=" + var18 + " AND groupid=" + var52;
                                                        }

                                                        Console.log("var84:"+var84);
                                                        var24.executeSql(var84);
                                                        if (var24.next()) {
                                                            var85 = Util.null2String(var24.getString("dtid"));
                                                            if (!"".equals(var85)) {
                                                                var188 = "";
                                                                var188 = " update " + var44 + " set";
                                                                var189 = 0;
                                                                var88 = " ";

                                                                Iterator var196;
                                                                String var198;
                                                                for(var196 = var180.entrySet().iterator(); var196.hasNext(); var88 = ",") {
                                                                    ++var189;
                                                                    Entry var193 = (Entry)var196.next();
                                                                    var201 = var193.getKey().toString();
                                                                    var198 = "";
                                                                    if (var193.getValue() != null) {
                                                                        if (String.valueOf(var193.getValue()).equals(" ")) {
                                                                            var198 = "";
                                                                        } else {
                                                                            var198 = String.valueOf(var193.getValue());
                                                                        }
                                                                    }

                                                                    var188 = var188 + var88 + " " + var201 + "=? ";
                                                                }

                                                                var188 = var188 + " where id = " + var85;
                                                                if (var189 > 0) {
                                                                    ConnStatement var195 = null;

                                                                    try {
                                                                        var195 = new ConnStatement();
                                                                        var195.setStatementSql(var188);
                                                                        var196 = var180.entrySet().iterator();

                                                                        for(var189 = 0; var196.hasNext(); var195.setString(var189, var93)) {
                                                                            ++var189;
                                                                            Entry var202 = (Entry)var196.next();
                                                                            var198 = var202.getKey().toString();
                                                                            var93 = "";
                                                                            if (var202.getValue() != null) {
                                                                                if (String.valueOf(var202.getValue()).equals(" ")) {
                                                                                    var93 = "";
                                                                                } else {
                                                                                    var93 = String.valueOf(var202.getValue());
                                                                                }
                                                                            }
                                                                        }

                                                                        var195.executeUpdate();
                                                                    } catch (Exception var157) {
                                                                        this.writeLog(var157);
                                                                    } finally {
                                                                        if (var195 != null) {
                                                                            var195.close();
                                                                        }

                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                } catch (Exception var161) {
                                                    this.writeLog(var161);
                                                }
                                            }
                                        } catch (Exception var162) {
                                            var164.add(var46 + "," + var67 + "," + -1);
                                        }
                                    }

                                    if (!var176 && (!var175 || var177)) {
                                        var164.add(var46 + "," + var67 + "," + -1);
                                    }
                                }

                                ++var67;
                                if (var176) {
                                    var165 = false;
                                }
                            }

                            if ("1".equals(var55) || "1".equals(var17)) {
                                for(int var181 = 0; var181 < var169; ++var181) {
                                    var72 = var181 + 1;
                                    if (!var171.contains(var72)) {
                                        if (var20 == 1) {
                                            var16 = "delete from " + var44 + " where " + var45 + "=" + var42;
                                        } else {
                                            var16 = "delete from " + var44 + " where requestid=" + var18 + " and groupid=" + var52;
                                        }

                                        var16 = var16 + " AND " + this.getPKCondition(var34, var43, var44, var19, var20, var52, var181);

                                        int dtno = Util.getIntValue(var1.getParameter("dtno"),-1);
                                        if(dtno==-1){
                                            Console.log("未递明细表序号,清空所有明细表");
                                            Console.log("delete SQL:"+var16);
                                            var24.executeSql(var16);
                                        }else{
                                            String dtMark="_dt"+dtno;
                                            //Console.log("传递明细表序号,导入的明细标识为"+dtMark+",不删除其他明细表的数据");
                                            if(var16.contains(dtMark)){
                                                Console.log("delete SQL:"+var16);
                                                var24.executeSql(var16);
                                            }
                                        }

                                       //

                                    }
                                }
                            }

                            ++var46;
                            break;
                        }

                        if (!"fnaFeeWf".equals(var31) && !"change".equals(var31) && !"share".equals(var31)) {
                            var165 = false;
                        } else {
                            boolean var69 = true;

                            for(int var70 = 0; var70 < var60.size(); ++var70) {
                                ArrayList var71 = Util.TokenizerString((String)var59.get(var70), "_");
                                var72 = -1;

                                try {
                                    var72 = Util.getIntValue((String)var71.get(2));
                                } catch (Exception var155) {
                                }

                                String var73 = "";
                                int var74 = 0;
                                String var75 = "";

                                try {
                                    var73 = Util.null2String((String)var59.get(var70)).trim();
                                } catch (Exception var154) {
                                }

                                try {
                                    var74 = Util.getIntValue(var73.split("_")[0].replaceAll("field", ""));
                                } catch (Exception var153) {
                                }

                                try {
                                    var75 = Util.null2String((String)var60.get(var70)).trim();
                                } catch (Exception var152) {
                                }

                                String var76 = Util.null2String(var48.getValue("" + var46, "" + var67, "" + (var70 + 2)));
                                if (!"".equals(var76)) {
                                    int var77 = Util.getIntValue((String)var71.get(3));
                                    if ((var77 != 1 || var72 != 1) && (var77 != 2 || var72 != 2)) {
                                        var76 = var76.trim();
                                    }

                                    if (var77 == 1 && var72 == 1) {
                                        var76 = var76.replaceAll("<br>", "").replaceAll("\r", "").replaceAll("\n", "");
                                    }
                                }

                                if (!"".equals(var76)) {
                                    var69 = false;
                                }

                                String var178 = "_sheetcount_" + var46 + "_rows_" + var67;
                                if ("fieldIdOrgId_fieldId".equals(var29.get(var74 + ""))) {
                                    var68.put("orgIdFieldId" + var178, var73 + "");
                                    var68.put("orgIdFieldId_int_" + var178, var74 + "");
                                } else if ("fieldIdOrgId2_fieldId".equals(var29.get(var74 + ""))) {
                                    var68.put("orgId2FieldId" + var178, var73 + "");
                                    var68.put("orgId2FieldId_int_" + var178, var74 + "");
                                } else if ("fieldIdOrgType_fieldId".equals(var29.get(var74 + ""))) {
                                    var68.put("orgTypeFieldId" + var178, var74 + "");
                                    var68.put("orgTypeFieldValue" + var178, var76 + "");
                                } else if ("fieldIdOrgType2_fieldId".equals(var29.get(var74 + ""))) {
                                    var68.put("orgType2FieldId" + var178, var74 + "");
                                    var68.put("orgType2FieldValue" + var178, var76 + "");
                                }
                            }

                            if (var69) {
                                var165 = false;
                            }
                        }

                        ++var67;
                    }
                }

                SubjectFilter var166 = new SubjectFilter();
                var166.filterSubject(var18, var25, var43, var44);
                if ("1".equals(var23)) {
                    var3.calFieldTrigger(var19, var25, var18, var20, var43, var44);
                }

                this.getColCalStr(var19, var18, var43, var49, var42, var20, var44);
                String var167 = " ";
                if (var2.getLanguage() != 8) {
                    var167 = "";
                }

                if (var164.size() > 0) {
                    StringBuffer var168 = new StringBuffer();

                    for(Iterator var170 = var164.iterator(); var170.hasNext(); var168.append(var167 + SystemEnv.getHtmlLabelName(27593, var2.getLanguage()) + "!\\n")) {
                        String var172 = (String)var170.next();
                        String[] var182 = var172.split(",");
                        var168.append(var167 + SystemEnv.getHtmlLabelName(15323, var2.getLanguage()) + var167 + var182[0] + var167 + SystemEnv.getHtmlLabelName(27591, var2.getLanguage()) + var167 + "sheet" + var167 + SystemEnv.getHtmlLabelName(15323, var2.getLanguage()) + var167 + var182[1] + var167 + SystemEnv.getHtmlLabelName(27592, var2.getLanguage()) + var167);
                        if (!"-1".equals(var182[2])) {
                            var168.append(var167 + SystemEnv.getHtmlLabelName(15323, var2.getLanguage()) + var167 + var182[2] + var167 + SystemEnv.getHtmlLabelName(18621, var2.getLanguage()) + var167);
                        }
                    }

                    var15 = var15 + var168.toString();
                }
            }
        } catch (Exception var163) {
            this.writeLog(var163);
            var15 = SystemEnv.getHtmlLabelName(27593, var2.getLanguage()) + "!\\n";
        }

        return var15;
    }

    private String getPKCondition(FieldInfo var1, String var2, String var3, int var4, int var5, int var6, int var7) {
        String var8;
        if (var5 == 0) {
            var8 = "id";
        } else if (var4 != 156 && var4 != 157 && var4 != 158 && var4 != 159) {
            if (var4 != 7 && var4 != 14 && var4 != 18) {
                if (var2.indexOf("formtable_main_") != 0 && var2.indexOf("uf_") != 0 || var3.indexOf("formtable_main_") != 0 && var3.indexOf("uf_") != 0) {
                    if (var4 < 0) {
                        var8 = "inputid";
                    } else {
                        var8 = "id";
                    }
                } else {
                    var8 = "id";
                }
            } else {
                var8 = "id";
            }
        } else {
            var8 = "dsporder";
        }

        return var8 + "='" + ((List)var1.getDetailTableIds().get(var6)).get(var7) + "'";
    }

    private Map getTableFieldValueMap(String var1) {
        HashMap var2 = new HashMap();
        ArrayList var3 = new ArrayList();
        ArrayList var4 = new ArrayList();
        new ArrayList();
        String var6 = "";
        RecordSet var7 = new RecordSet();
        String var8 = "";
        String var9 = "";
        var6 = "select t2.workflowid,t1.formid,t1.isbill from workflow_base t1 join workflow_requestbase t2 on t1.id=t2.workflowid where t2.requestid=" + var1;
        var7.executeSql(var6);
        if (var7.next()) {
            var9 = Util.null2String(var7.getString("formid"));
            var8 = Util.null2String(var7.getString("isbill"));
        }

        String var10;
        String var11;
        String var12;
        String var13;
        if (var8.equals("1")) {
            var6 = "select id,fieldname,detailtable from workflow_billfield where (detailtable is null or detailtable='') and billid = " + var9;
            var7.executeSql(var6);

            while(var7.next()) {
                var10 = Util.null2String(var7.getString("fieldname")).toLowerCase();
                var3.add(var10);
            }

            WorkflowBillComInfo var21 = null;

            try {
                var21 = new WorkflowBillComInfo();
            } catch (Exception var20) {
                var20.printStackTrace();
            }

            var11 = var21.getTablename(var9);
            var12 = var21.getDetailkeyfield(var9);
            var13 = "";
            var6 = "select * from " + var11 + " where requestid=" + var1;
            var7.executeSql(var6);
            String var16;
            if (var7.next()) {
                var13 = Util.null2String(var7.getString("id"));

                for(int var14 = 0; var14 < var3.size(); ++var14) {
                    String var15 = (String)var3.get(var14);
                    var16 = Util.null2String(var7.getString(var15));
                    var2.put("$" + var15 + "$", var16);
                }
            }

            var6 = "select distinct detailtable from workflow_billfield where detailtable is not null and detailtable !='' and billid = " + var9;
            var7.executeSql(var6);

            while(var7.next()) {
                String var23 = Util.null2String(var7.getString("detailtable")).toLowerCase();
                RecordSet var24 = new RecordSet();
                var6 = "select fieldname from workflow_billfield where detailtable='" + var23 + "' and billid = " + var9;
                var24.executeSql(var6);

                while(var24.next()) {
                    var16 = Util.null2String(var24.getString("fieldname")).toLowerCase();
                    var4.add(var16);
                }

                var6 = "select * from " + var23 + " where " + var12 + "=" + var13;
                var24.executeSql(var6);

                for(int var25 = 0; var24.next(); ++var25) {
                    for(int var17 = 0; var17 < var4.size(); ++var17) {
                        String var18 = (String)var4.get(var17);
                        String var19 = Util.null2String(var24.getString(var18));
                        var2.put("$" + var23 + "_" + var18 + "_" + var25 + "$", var19);
                    }
                }
            }
        } else {
            var6 = "select b.id,b.fieldname from workflow_formfield a,workflow_formdict b where a.fieldid = b.id and formid = " + var9;
            var7.executeSql(var6);

            while(var7.next()) {
                var10 = Util.null2String(var7.getString("fieldname"));
                var3.add(var10);
            }

            var10 = "";
            var6 = "select * from workflow_form where requestid=" + var1;
            var7.executeSql(var6);
            int var22;
            if (var7.next()) {
                for(var22 = 0; var22 < var3.size(); ++var22) {
                    var12 = (String)var3.get(var22);
                    var13 = Util.null2String(var7.getString(var12));
                    var2.put("$" + var12 + "$", var13);
                }
            }

            var6 = "select b.id,b.fieldname from workflow_formfield a,workflow_formdictdetail b where a.fieldid = b.id and formid = " + var9;
            var7.executeSql(var6);

            while(var7.next()) {
                var11 = Util.null2String(var7.getString("fieldname"));
                var4.add(var11);
            }

            var6 = "select * from workflow_formdetail where requestid=" + var1;
            var7.executeSql(var6);
            if (var7.next()) {
                for(var22 = 0; var22 < var4.size(); ++var22) {
                    var12 = (String)var4.get(var22);
                    var13 = Util.null2String(var7.getString(var12));
                    var2.put("$detail_" + var12 + "_" + var22 + "$", var13);
                }
            }
        }

        return var2;
    }

    public String forMultiLangSql(String var1, String var2, String var3, String var4) {
        return this.forMultiLangSql(var1, var2, var3, var4, this.currentUserLang, (String)null);
    }

    public String forMultiLangSql(String var1, String var2, String var3, String var4, String var5) {
        return this.forMultiLangSql(var1, var2, var3, var4, this.currentUserLang, var5);
    }

    public String forMultiLangSql(String var1, String var2, String var3, String var4, int var5, String var6) {
        String var7 = "";
        if (var5 > 9) {
            var7 = var5 + "";
        } else {
            var7 = var5 + " ";
        }

        String var8 = "";
        if (Util.isEnableMultiLang()) {
            var8 = "SELECT " + var2 + " FROM " + var1 + " WHERE (" + var3 + "='" + var4 + "'  or " + var3 + " like '%`~`" + var7 + var4 + "`~`%')";
            if (var6 != null && !var6.equals("")) {
                var8 = var8 + var6;
            }
        } else {
            var8 = "SELECT " + var2 + " FROM " + var1 + " WHERE " + var3 + "='" + var4 + "' ";
            if (var6 != null && !var6.equals("")) {
                var8 = var8 + var6;
            }
        }

        return var8;
    }

    private ArrayList<Integer> getDetailTableOrder(List<String> var1, int var2) {
        ArrayList var3 = new ArrayList();
        String var4 = "select orderid from workflow_billdetailtable where billid=? and  tablename=? ";
        RecordSet var5 = new RecordSet();
        Iterator var6 = var1.iterator();

        while(var6.hasNext()) {
            String var7 = (String)var6.next();
            var5.executeQuery(var4, new Object[]{var2, var7});
            if (var5.next()) {
                var3.add(var5.getInt("orderid"));
            }
        }

        return var3;
    }


}
